package com.nix.web.databases.service.user;

import com.nix.web.databases.mapper.user.UserMapper;
import com.nix.web.databases.pojo.user.Info;
import com.nix.web.databases.pojo.user.Role;
import com.nix.web.databases.pojo.user.User;
import com.nix.web.databases.pojo.word.Word;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhangpei
 * @Email zhangpe0312@qq.com
 * @day 2017/12/5 17:20
 * @Use
 */
@Service
public class UserService  implements UserMapper{
    @Autowired
    UserMapper userMapper;

    @Override
    public User login(String name, String password) throws Exception {
         return userMapper.login(name,password);
    }

    @Override
    public User loginByName(String name) throws Exception {
        return userMapper.loginByName(name);
    }

    @Override
    public User getUserInformation(Integer uid, Integer enable) throws Exception{
        return userMapper.getUserInformation(uid,enable);
    }

    @Override
    public int register(Integer uid, Integer infoid) throws Exception {
        return userMapper.register(uid,infoid);
    }

    @Override
    public Integer getUserIdByEmail(String email) {
        return userMapper.getUserIdByEmail(email);
    }


    @Override
    public User getUserPermission(Integer uid) throws Exception {
        return userMapper.getUserPermission(uid);
    }

    @Override
    public void addRole(Integer uid, Integer rid) {
        userMapper.addRole(uid,rid);
    }

    @Override
    public boolean add(User user)  throws Exception{
        return userMapper.add(user);
    }

    @Override
    public boolean delete(Integer id)  throws Exception{
        return userMapper.delete(id);
    }

    @Override
    public boolean update(User user)  throws Exception{
        return userMapper.update(user);
    }

    @Override
    public User select(Integer id)  throws Exception{
        return userMapper.select(id);
    }

}
